GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

favicon.js ➔ ... ➔ error   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 5
c 1
b 0
f 0
rs 9.4285
cc 2
nc 2
nop 1
1
var path = require('path');
2
var fs = require('fs');
3
var dest = path.resolve('./applications/assets/icons/');
4
5
// var tidy = require("tidy-html5").tidy_html5
6
// var tidyOptions = {
7
//         'add-xml-decl': false,
8
//         'input-xml': true,
9
//         'output-xml': true,
10
//         'output-html': false,
11
//         'indent': true,
12
//         'indent-spaces': 2,
13
//         'wrap': 0,
14
//         'vertical-space': true,
15
//         'quiet': true,
16
//         'show-info': false,
17
//         'show-warnings': false,
18
//     };
19
20
var favicons = require('favicons'),
21
    source = path.resolve('./assets/images/logo.png'),  // Source image(s). `string`, `buffer` or array of `string`
22
    configuration = {
23
        appName: "Impresa Luna",
24
        appDescription: "Gestione imprese",
25
        developerURL: "https://github.com/BitPrepared/d1b0#readme",
26
        background: "#fff",             // Background colour for flattened icons. `string`
27
        path: "/assets/icons/",                      // Path for overriding default icons path. `string`
28
        display: "standalone",          // Android display: "browser" or "standalone". `string`
29
        orientation: "portrait",        // Android orientation: "portrait" or "landscape". `string`
30
        version: "1.0",                 // Your application's version number. `number`
31
        logging: false,                 // Print logs to console? `boolean`
32
        online: false,                  // Use RealFaviconGenerator to create favicons? `boolean`
33
        preferOnline: false,            // Use offline generation, if online generation has failed. `boolean`
34
        icons: {
35
            android: true,              // Create Android homescreen icon. `boolean`
36
            appleIcon: true,            // Create Apple touch icons. `boolean` or `{ offset: offsetInPercentage }`
37
            appleStartup: true,         // Create Apple startup images. `boolean`
38
            coast: { offset: 25 },      // Create Opera Coast icon with offset 25%. `boolean` or `{ offset: offsetInPercentage }`
39
            favicons: true,             // Create regular favicons. `boolean`
40
            firefox: true,              // Create Firefox OS icons. `boolean` or `{ offset: offsetInPercentage }`
41
            windows: true,              // Create Windows 8 tile icons. `boolean`
42
            yandex: true                // Create Yandex browser icon. `boolean`
43
        }
44
    },
45
    callback = function (error, response) {
46
        if (error) {
47
            console.log(error.status);  // HTTP error code (e.g. `200`) or `null`
0 ignored issues
show
Debugging Code introduced by
console.log looks like debug code. Are you sure you do not want to remove it?
Loading history...
48
            console.log(error.name);    // Error name e.g. "API Error"
49
            console.log(error.message); // Error description e.g. "An unknown error has occurred"
50
        }
51
        //console.log(response.images);   // Array of { name: string, contents: <buffer> }
52
        //console.log(response.files);    // Array of { name: string, contents: <string> }
53
        //console.log(response.html);     // Array of strings (html elements)
54
        error = function (err) {
55
          if (err) {
56
            console.log(err);
0 ignored issues
show
Debugging Code introduced by
console.log looks like debug code. Are you sure you do not want to remove it?
Loading history...
57
          }
58
        };
59
60
        var len = response.images.length;
61
        for (var i = 0; i < len; i++) {
62
          fs.writeFile(path.join(dest,response.images[i].name), response.images[i].contents, error);
63
        }
64
        var logStream = fs.createWriteStream(path.join(dest,'icons.html'), {flags:'a'});
65
        var lenHtml = response.html.length;
66
        var html = "";
67
        for (var j = 0; j < lenHtml; j++) {
68
          html += response.html[j]+"\n";
69
        }
70
        logStream.write(html);
71
    };
72
73
favicons(source, configuration, callback);
74